package com.fragment.demo;

import baidumapsdk.demo.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class TitleBarView extends RelativeLayout {
	private Context a;
	private TextView b;
	private ImageView c;
	private RelativeLayout d;
	private RelativeLayout e;
	private View f;
	private View g;
	private LinearLayout h;
	private LinearLayout i;

	public TitleBarView(Context paramContext) {
		super(paramContext);
		this.a = paramContext;
		b();
	}

	public TitleBarView(Context paramContext, AttributeSet paramAttributeSet) {
		super(paramContext, paramAttributeSet);
		this.a = paramContext;
		b();
	}

	private void b() {
		((LayoutInflater) this.a.getSystemService("layout_inflater")).inflate(R.layout.layout_title_bar, this);
		if (isInEditMode())
			return;
		this.b = ((TextView) findViewById(R.id.title));
		this.c = ((ImageView) findViewById(R.id.title_icon));
		this.f = findViewById(R.id.item_left_divider);
		this.g = findViewById(R.id.item_right_divider);
		this.d = ((RelativeLayout) findViewById(R.id.title_left));
		this.e = ((RelativeLayout) findViewById(R.id.title_right));
		this.h = ((LinearLayout) findViewById(R.id.layout_title_default));
		this.i = ((LinearLayout) findViewById(R.id.layout_title_ext));
	}

	public final void a() {
		this.h.setVisibility(8);
		this.i.setVisibility(0);
	}

	public final void a(int paramInt) {
		this.b.setText(paramInt);
	}

	public final void a(View paramView) {
		LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, -2);
		localLayoutParams.gravity = 17;
		this.i.removeAllViewsInLayout();
		this.i.addView(paramView, localLayoutParams);
	}

	public final void a(View paramView, View.OnClickListener paramOnClickListener) {
		this.d.removeAllViewsInLayout();
		RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(-1, -1);
		localLayoutParams.addRule(13);
		// paramView.setOnClickListener(paramOnClickListener);
		this.d.addView(paramView, localLayoutParams);
		View localView = new View(this.a);
		localView.setBackgroundResource(R.drawable.selector_button_titlebar_bg);
		localView.setOnClickListener(paramOnClickListener);
		// localView.setOnClickListener(new ba(this, paramOnClickListener,paramView));
		this.d.addView(localView, localLayoutParams);
		this.d.setVisibility(0);
	}

	public final void a(CharSequence paramCharSequence) {
		this.b.setText(paramCharSequence);
	}

	public final void b(int paramInt) {
		this.d.setVisibility(paramInt);
	}

	public final void b(View paramView, View.OnClickListener paramOnClickListener) {
		this.e.removeAllViewsInLayout();
		RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(-1, -1);
		localLayoutParams.addRule(13);
		paramView.setOnClickListener(paramOnClickListener);
		this.e.addView(paramView, localLayoutParams);
		View localView = new View(this.a);
		localView.setBackgroundResource(R.drawable.selector_button_titlebar_bg);
		// localView.setOnClickListener(new bb(this, paramOnClickListener,paramView));
		this.e.addView(localView, localLayoutParams);
		this.e.setVisibility(0);
	}

	public final void c(int paramInt) {
		this.e.setVisibility(paramInt);
	}
}